Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose all settings in ydata-profiling ProfileReport #2921

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eapolinario
Copy link
Collaborator

@eapolinario eapolinario commented Nov 12, 2024

Why are the changes needed?

ydata-profiling ProfileReport has a rich set of settings that should be exposed in flyte decks.

What changes were proposed in this pull request?

Expose kwargs passed directly to the constructor of ProfileReport.

I set the minimal version of ydata-profiling to 2.4.0 to support minimal-mode.

How was this patch tested?

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Related to flyteorg/flyte#5993

Docs link

Summary by Bito

This PR enhances ydata-profiling integration in flytekit-deck-standard by exposing all ProfileReport constructor settings. The FrameProfilingRenderer now supports custom configuration via kwargs while maintaining backward compatibility. The minimum ydata-profiling version is set to 2.4.0 to support features like minimal-mode.

Unit tests added: True

Estimated effort to review (1-5, lower is better): 2

@@ -53,12 +53,21 @@ class FrameProfilingRenderer:
Generate a ProfileReport based on a pandas DataFrame
"""

def __init__(self, title: str = "Pandas Profiling Report"):
def __init__(self, title: Optional[str] = None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API wise, there are now two places to set kwargs for ydata_profiling.ProfileReport, in __init__ (for only title) and in to_html.

By looking at the Renderable protocol, it looks like the design was to have configuration passed in __init__, because the to_html to restricted to one input:

https://github.com/flyteorg/flytekit/blob/master/flytekit/deck/renderer.py#L17-L23

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I saw that, but I don't think we quite adhering to the protocol everywhere, for example the pandera renderer.

This is an indication that all invocations of to_html happen in user-code, so the protocol is "just" a convention? Can we make it more strict (and if so, I think we should add kwargs to the protocol).

@eapolinario
Copy link
Collaborator Author

/review

@eapolinario
Copy link
Collaborator Author

eapolinario commented Dec 27, 2024

Code Review Agent Run #3d8b84

Actionable Suggestions - 1
  • plugins/flytekit-deck-standard/tests/test_renderer.py - 1
    • Consider removing duplicate test case · Line 44-45
Additional Suggestions - 1
  • plugins/flytekit-deck-standard/flytekitplugins/deck/renderer.py - 1
    • Consider removing redundant kwargs check · Line 64-65
Review Details
  • Files reviewed - 4 · Commit Range: 3793e84..3793e84
    • plugins/flytekit-deck-standard/dev-requirements.in
    • plugins/flytekit-deck-standard/flytekitplugins/deck/renderer.py
    • plugins/flytekit-deck-standard/setup.py
    • plugins/flytekit-deck-standard/tests/test_renderer.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

@eapolinario
Copy link
Collaborator Author

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Feature Improvement - Enhanced ydata-profiling Integration

dev-requirements.in - Added lxml dependency for HTML parsing

renderer.py - Modified FrameProfilingRenderer to support flexible configuration options

setup.py - Updated ydata-profiling version requirement to >=2.4.0

test_renderer.py - Added comprehensive tests for ProfileReport configuration options

Comment on lines +44 to +45
("Custom Title", {"minimal": True}, "Custom Title"),
("Custom Title", { "minimal": True}, "Custom Title"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing duplicate test case

Consider removing the duplicate test case ("Custom Title", { "minimal": True}, "Custom Title") as it is identical to the test case on line 44. A similar issue was also found in plugins/flytekit-deck-standard/tests/test_renderer.py (line 44-45).

Code suggestion
Check the AI-generated fix before applying
Suggested change
("Custom Title", {"minimal": True}, "Custom Title"),
("Custom Title", { "minimal": True}, "Custom Title"),
("Custom Title", {"minimal": True}, "Custom Title"),

Code Review Run #3d8b84


Is this a valid issue, or was it incorrectly flagged by the Agent?

  • it was incorrectly flagged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants